home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / Legend.pxl < prev    next >
Text File  |  2000-12-23  |  6KB  |  222 lines

  1. Initialize:
  2.     UseCoordinates(PIXEL)
  3.     SetColorPalette(BITMAP)
  4.     Title$ = "PiXCL Image Display with Legends"
  5.     UseCaption(Title$)
  6.     WinLocate(Title$,100,100,880,610,Res)
  7.     WinShow(Title$,TOPMOST,Res)
  8.     ImageFile$ = ""
  9.     UseBackground(TRANSPARENT,192,192,192)
  10.     DrawBackground
  11.     DirGet(SourceDir$)
  12.     
  13.     Image1$ = SourceDir$ + "\brsfbnd1.bmp"
  14.     Image2$ = SourceDir$ + "\brsfbnd2.bmp"
  15.     Image3$ = SourceDir$ + "\brsfbnd3.bmp"
  16.     Image4$ = SourceDir$ + "\brsfbnd4.bmp"
  17.     Image5$ = SourceDir$ + "\brsfbnd5.bmp"
  18.     Image7$ = SourceDir$ + "\brsfbnd7.bmp"
  19.     Image8$ = SourceDir$ + "\brsfc754.bmp"
  20.     Image9$ = SourceDir$ + "\brstclas.bmp"
  21.     Image10$ = SourceDir$ + "\brstgrid.bmp"
  22.  
  23.     UseFont("MS Sans Serif",0,19,NOBOLD,NOITALIC,NOUNDERLINE,255,0,0)
  24.     InitFile$ = "*.bmp"
  25.  
  26.     InfoMenu(REMOVE)
  27.     WaitInput(100)
  28.     SetMenu("&File",IGNORE,
  29.         "Exit!",Leave,
  30.         ENDPOPUP,
  31.         "Image Info",IGNORE,
  32.         "GetBitMapInfo",GetImageInfo,
  33.         "Reload",ReloadImage,
  34.         "Class Overlays",OverlayThemes,
  35.         "Grid Overlays",OverlayGrids,
  36.         "Create Legend",CreateLegend,
  37.         "Adjust Legend",AdjustLegend,
  38.         "Interactive Legend",InteractiveLegend,
  39.         ENDPOPUP)
  40.  
  41.     StatusWindow(ENABLE,BOTTOM,4,290,390,490,-1)
  42.  
  43.  
  44.        Filter$ = "BMP files(*.bmp),*.bmp,JPG files(*.jpg),*.jpg,"
  45.     Filter$ = Filter$ + "PNG files(*.png),*.png,PCX files(*.pcx),*.pcx,"
  46.     Filter$ = Filter$ + "PSD files(*.psd),*.psd,RAS files(*.ras),*.ras,"
  47.     Filter$ = Filter$ + "TGA files(*.tga),*.tga,TIF files(*.tif),*.tif"
  48.  
  49. Wait_for_Input:
  50.     WaitInput()
  51.  
  52. Leave:
  53.     End
  54.  
  55. CountTheList:
  56.     Chr(13,CR$)
  57.     ListLoadedBitmaps(List$,CR$,Count)
  58.     Str(Count,Count$)
  59.     Msg$ = "Entries in PiXCL Bitmap List = " + Count$
  60.     MessageBox(OK,1,INFORMATION,List$,Msg$,Res)
  61.     Goto Wait_for_Input
  62.  
  63. GetImageInfo:
  64.     DrawBackGround
  65.     SetMouse()
  66.     SetRightMouse()
  67.     If ImageFile$ <> "" Then FreeBitMap(ImageFile$)
  68.     FileGet(Filter$, InitFile$, "",
  69.         "Test of PXLimage v4.2 DLL",CHANGEDIR,ImageFile$)
  70.     If ImageFile$ = "" Then Goto Wait_for_Input
  71.     
  72.     FileExtension(ImageFile$,Ext$,Res)
  73.     InitFile$ = "*." + Ext$
  74.     Ext$ = Ext$ + " Image File Format Read"
  75.     GetBitMapDim(ImageFile$,Lines,Pixels,Bits)
  76.     DrawBackGround
  77. {    DrawText(25,0,Ext$)
  78.     DrawText(560,30,"Lines") DrawNumber(660,30,Lines)
  79.     DrawText(560,50,"Pixels") DrawNumber(660,50,Pixels)
  80.     DrawText(560,70,"Bits") DrawNumber(660,70,Bits)
  81. }
  82.  
  83.     If Bits <> 0
  84.         sx1 = 20  sy1 = 20
  85.         sx2 = 26 + Pixels    sy2 = 26 + Lines
  86.         DrawEdgeRectangle(sx1,sy1,sx2,sy2,SUNKENEDGE,ADJUST,RECT)
  87.         DrawBitMap(23,23,ImageFile$)
  88.     Endif
  89.     Goto Wait_for_Input
  90. ReloadImage:
  91.     FreeBitmap(ImageFile$)
  92.     DrawBitMap(23,23,ImageFile$)
  93.     Goto Wait_for_Input
  94.  
  95. OverlayThemes:
  96.     If ImageFile$ = "" Then Beep Goto Wait_for_Input
  97.     LoadBitmap(Image9$,FULL)
  98.     DrawBitMap(23,23,ImageFile$)
  99.     OverlayImage(Image9$, 0,0,0, Res)
  100.     GetBitMapDim(ImageFile$,Lines,Pixels,Bits)
  101.     DrawBitMap(23,23,ImageFile$) 
  102.     Goto Wait_for_Input
  103.  
  104. OverlayGrids:
  105.     If ImageFile$ = "" Then Beep Goto Wait_for_Input
  106.     WaitInput(1)
  107.     LoadBitmap(Image10$,FULL)
  108.     DrawBitmap(23,23,ImageFile$)
  109.     OverlayImage(Image10$, 255,255,255, Res)
  110.     If Res = 0 
  111.         MessageBox(OK,1,INFORMATION,"Overlay failed","DEBUG",Res)
  112.     Endif
  113.     GetBitMapDim(ImageFile$,Lines,Pixels,Bits)
  114.     DrawBitmap(23,23,ImageFile$) 
  115.     Goto Wait_for_Input
  116.  
  117. CreateLegend:
  118.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  119.     Lx1 = sx2 + 10   Ly1 = sy1
  120.     Lx2 = LX1 + 20  Ly2 = Ly1 + 23  Ly3 = Ly2 + 9
  121.     Tx2 = cx2 - 5
  122.     UsePen(SOLID,1,0,0,0)
  123.     UseBrush(SOLID,255,0,0)
  124.     UseFont("Arial",7,13,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  125.     DrawRectangle(Lx1,Ly1,Lx2,Ly2)
  126.     Tx1 = Lx2 + 5
  127.     DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #1: wetland regions, medium moisture levels.",LEFT)
  128.     
  129.     Ly1 = Ly2 + 15
  130.     Ly2 = Ly1 + 23
  131.     Ly3 = Ly2 + 9
  132.     UseBrush(SOLID,0,255,0)
  133.     DrawRectangle(Lx1,Ly1,Lx2,Ly2)
  134.     Tx1 = Lx2 + 5
  135.     DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #2: bare rock surfaces",LEFT)
  136.  
  137.     Ly1 = Ly2 + 15
  138.     Ly2 = Ly1 + 23
  139.     Ly3 = Ly2 +9
  140.     UseBrush(SOLID,0,0,255)
  141.     DrawRectangle(Lx1,Ly1,Lx2,Ly2)
  142.     Tx1 = Lx2 + 5
  143.     DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #3: mountainous regions with vegetation, moderate moisture levels",LEFT)
  144.  
  145.     Ly1 = Ly2 + 15
  146.     Ly2 = Ly1 + 23
  147.     Ly3 = Ly2 + 9
  148.     UseBrush(SOLID,255,255,0)
  149.     DrawRectangle(Lx1,Ly1,Lx2,Ly2)
  150.     Tx1 = Lx2 + 5
  151.     DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #4: low relief fractured rock surfaces.",LEFT)
  152.  
  153.     Ly1 = Ly2 + 15
  154.     Ly2 = Ly1 + 23
  155.     Ly3 = Ly2 + 9
  156.     UseBrush(SOLID,255,0,255)
  157.     DrawRectangle(Lx1,Ly1,Lx2,Ly2)
  158.     Tx1 = Lx2 + 5
  159.     DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #5: swamp and wetland regions, high moisture levels.",LEFT)
  160.  
  161.     Ly1 = Ly2 + 15
  162.     Ly2 = Ly1 + 23
  163.     Ly3 = Ly2 + 9
  164.     UseBrush(SOLID,0,255,255)
  165.     DrawRectangle(Lx1,Ly1,Lx2,Ly2)
  166.     Tx1 = Lx2 + 5
  167.     DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #6: highly reflective river sand regions, low moisture levels. ",LEFT)
  168.  
  169.     Goto Wait_for_Input
  170.  
  171. AdjustLegend:
  172.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  173.     SetMouse(cx1,cy1,cx2,cy2,Select_1,x,y)
  174.     WaitInput()
  175.  
  176. Select_1:
  177.     SetMouse()
  178.     Pattern7$ = SourceDir$ + "\pattern7.jpg"
  179.     px1 = x - 3       py1 = y - 3
  180.     px2 = x + 13      py2 = y + 13
  181.     
  182.     SaveRectangle(px1,py1,px2,py2,Pattern7$,Res)
  183.     WaitInput(500)
  184.     SetMouse(Lx1,Ly1,Lx2,Ly2,Select_2,x,y)
  185.     WaitInput()
  186. Select_2:
  187.     SetMouse()
  188.     FreeBitmap(Pattern7$) 
  189.     UseBrushPattern(Pattern7$)
  190.     DrawFloodExt(x,y,0,0,0,BORDER)
  191.     Goto Wait_for_Input
  192.  
  193.  
  194. InteractiveLegend:
  195.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  196.     SetMouse(cx1,cy1,cx2,cy2,Select_3,x,y)
  197.     WaitInput()
  198.  
  199. Select_3:
  200.     SetMouse()
  201.     Pattern7$ = SourceDir$ + "\pattern7.jpg"
  202.     px1 = x - 3       py1 = y - 3
  203.     px2 = x + 13      py2 = y + 13
  204.     SaveRectangle(px1,py1,px2,py2,Pattern7$,Res)
  205.     WaitInput(500) {let Windows catch up, flush the buffers}
  206.     Text$ = "Enter the description of this region"
  207.     Label$ = "Interactive Legend Generation"
  208.     Legend$ = ""
  209.     TextBox(Text$,Label$,Legend$,Btn)
  210.     If Btn = 2 Then Goto Wait_for_Input
  211.  
  212.     Ly1 = Ly2 + 15
  213.     Ly2 = Ly1 + 23
  214.     Ly3 = Ly2 + 9
  215.     FreeBitmap(Pattern7$) 
  216.     UseBrushPattern(Pattern7$)
  217.     DrawRectangle(Lx1,Ly1,Lx2,Ly2)
  218.     Tx1 = Lx2 + 5
  219.     DrawTextExt(Tx1,Ly1,Tx2,Ly3,Legend$,LEFT)
  220.     Goto Wait_for_Input
  221.  
  222.